package com.fang.chain;

import lombok.Data;

import java.io.Serializable;

/**
 * @author fanglingxiao
 * @version 1.0
 * @description TODO
 * @date 2022/4/24 1:58 下午
 **/
@Data
public class HandleResponse<T> implements Serializable {
    private static final long serialVersionUID = 1L;
    private Boolean success;
    private T data;
    private Integer code = 200;
    private String msg = "操作成功";

    public static <T> HandleResponse<T> succ() {
        HandleResponse<T> response = new HandleResponse<>();
        response.setSuccess(Boolean.TRUE);
        response.setCode(200);
        return response;
    }

    public static <T> HandleResponse<T> fail() {
        HandleResponse<T> response = new HandleResponse<>();
        response.setSuccess(Boolean.FALSE);
        response.setCode(500);
        return response;
    }
}
